﻿using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using System;
using System.Diagnostics;

namespace Server.Controllers
{
    public class HomeController : Controller
    {
       

        public string Index(string name)
        {
            try
            {
                var builder = new ConfigurationBuilder();
                builder.AddJsonFile("config.json");
                var configuration = builder.Build();
                Process.Start(configuration[name]);
            }
            catch (Exception ex)
            {
                return "fail:" + ex.ToString();
            }
            return "ok";
        }

    }
}
